package com.intgrt.manager.service.impl;

import org.springframework.stereotype.Service;

import com.intgrt.manager.entity.SysMenuBtn;
import com.intgrt.manager.service.SysMenuBtnService;
import com.intgrt.manager.service.base.impl.BaseServiceImpl;

@Service
public class SysMenuBtnServiceImpl extends BaseServiceImpl implements SysMenuBtnService {

	@Override
	public String getList(SysMenuBtn entity) {
		String content = "id,menuid,btnname,btnicon,btnfunc,btnshow,btnorder";
		String cdtsql = "sys_menu_btn where menuid ="+entity.getMenuid()+" order by btnorder";
		return getPageDate(content, cdtsql, entity.getPage(), entity.getRows()).toJSONString();
	}

	@Override
	public String saveEntity(SysMenuBtn entity) {
		String sql = "insert into sys_menu_btn (menuid,btnname,btnicon,btnfunc,btnshow,btnorder) values ("
				+ entity.getMenuid()+",'"+entity.getBtnname()+"','"+entity.getBtnicon()+"','"+entity.getBtnfunc()+"',"
				+ entity.getBtnshow()+","+entity.getBtnorder()+")";
		return this.execute(sql)+"";
	}

	@Override
	public String editEntity(SysMenuBtn entity) {
		String sql = "update sys_menu_btn set btnname = '"+entity.getBtnname()+"',btnicon = '"+entity.getBtnicon()+"', btnfunc = '"
				+ entity.getBtnfunc()+"', btnshow = "+entity.getBtnshow()+", btnorder = "
				+ entity.getBtnorder()+" where id = "+entity.getId();
		return this.execute(sql)+"";
	}

	@Override
	public String delEntity(String ids) {
		String sql = "delete from sys_menu_btn where id in ("+ids+")";
		return this.execute(sql)+"";
	}
}